package com.white.controller;

import com.white.bean.LikeView;
import com.white.mapper.LikeViewMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class LikeViewController {
    @Autowired
    LikeViewMapper likeViewMapper;

    @GetMapping("/getLikeViewById/{userId}")
    @ResponseBody
    public List<LikeView> getLikeViewById(@PathVariable("userId") Long userId) {
        return likeViewMapper.getLikeViewById(userId);
    }


    @GetMapping("/getLikeView")
    @ResponseBody
    public List<LikeView> getLikeView(@CookieValue(UserController.LOGIN_USER_ID) Long userId) {
        return likeViewMapper.getLikeViewById(userId);
    }

}
